package chapter05;

public class Test01_exception {
    public static void main(String[] args) {
        int a = 20;
        int b = 0;
//        System.out.println(20/0);
        //通过异常处理可以保证程序运行完毕 不中止程序运行
        try {
            System.out.println(20/0);
        }catch (Exception e){
            System.out.println(e.getMessage());
        }
        int[] c = {1,2,3,4};
        try {
            System.out.println(c[4]);
        }catch (Exception e){
            System.out.println(e);
        }
        System.out.println("程序结束");
    }
}
